package etric.mapmaker.base;


import etric.mapmaker.gui.GUI;
import etric.mapmaker.gui.GraphicalUserInterface;


public class OsmMapMaker
{
	/** save reference to the GUI */
	private GUI userInterface;
	
	/** constructor */
	public OsmMapMaker()
	{
		userInterface = new GraphicalUserInterface(this);
	}
	
	/** sets the used gui referece */
	public void setUserInterface(GUI gui)
	{
		this.userInterface = gui;
	}
	
	/** close the programm */
	public void quitGame()
	{
		System.exit(0);
	}	
	
	/** @param args */
	public static void main(String[] args)
	{
		
		OsmMapMaker mapmaker = new OsmMapMaker();
		
		mapmaker.userInterface.run();
		
		
		
		
		
		
		
		
		
		
		
		/*
		
		
		String layer = TileMap.LAYER_MAPNIK;
		int gridWidth = 5;
		int zoom = 14;
		int xCenter = 8595;
		int yCenter = 5338;
		String mapTitel = "Weyhe";

		System.out.println("Creating the Bounding Box");
		
		int gridShift = gridWidth/2;
		double pointN = CoordsConvert.convYtoLat(yCenter - gridShift, zoom);
		double pointS = CoordsConvert.convYtoLat(yCenter + gridShift+1, zoom);
		double pointE = CoordsConvert.convXtoLong(xCenter + gridShift+1, zoom);
		double pointW = CoordsConvert.convXtoLong(xCenter - gridShift, zoom);
		
		BoundingBox bb = new BoundingBox(pointN, pointE, pointS, pointW);
		
		
		System.out.println("Downloading the tiles.");
		
		TileMap td = new TileMap(mapTitel, layer);
		td.getTiles(gridWidth, zoom, xCenter, yCenter);
		
		System.out.println("creating the map from");
		
		td.mergeTiles(gridWidth);
		
		System.out.println("Finished map creation.");
		
		System.out.println("Creating calibration file.");
		
		
		OziMapFile calibrate = new OziMapFile();
		
		calibrate.parseMapFile(mapmaker, mapTitel,
								"map/Weyhe",
								bb.getPointN(),
								bb.getPointS(),
								bb.getPointW(),
								bb.getPointE(),
								gridWidth*256);

		System.out.println("calibration file created.");
		
		double lantitude = bb.getCenterLat();
		double longitude = bb.getCenterLong();
		
		System.out.println("Center Long: " + CoordsConvert.convToDegMinSec(longitude) + "E");
		System.out.println("Center Lat:  " + CoordsConvert.convToDegMinSec(lantitude) + "N");

		System.out.println("Distance: " + bb.boxWidth());
	*/
		
	}

}
